GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmOmp.h File Reference

Declaration of helper functions for using OpenMP that translate into "empty" statements if compiled without OpenMP support. More...

#include <assert.h>
Include dependency graph for gmOmp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  GmOmpTempUpdateNumThreads
 A RAII class used to temporarily adjust the number of OMP threads in effect. More...
 

Macros

#define GM_OMP_ASSERT_NO_DYNAMIC   ((void)0)
 

Functions

void GmOmpInit (int maxThreads)
 Initializes OpenMP to use the given maximum number of threads. It also disables dynamic scheduling.
 
int GmOmpAdjustNumThreads (int nt)
 Adjusts the given number of threads. If nt <= 0 or if nt > maximum number of omp threads, returns the maximum number of threads. Otherwise returns nt.
 
int GmOmpThreadNum ()
 Returns the current Open Mp thread number (omp_get_thread_num()).
 

Detailed Description

Declaration of helper functions for using OpenMP that translate into "empty" statements if compiled without OpenMP support.

Author
Carlos Augusto Teixeira Mendes
Date
april, 2020

Function Documentation

◆ GmOmpAdjustNumThreads()

int GmOmpAdjustNumThreads ( int nt)
inline

Adjusts the given number of threads. If nt <= 0 or if nt > maximum number of omp threads, returns the maximum number of threads. Otherwise returns nt.

If compiling without OpenMP support, always returns 1.

◆ GmOmpThreadNum()

int GmOmpThreadNum ( )
inline

Returns the current Open Mp thread number (omp_get_thread_num()).

If compiling without OpenMP support, always returns 0.